/*
	PSP - Particle system
	Copyright (C) 2006  Jesper Sandberg

	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef _JSA_PARTICLE_H_
#define _JSA_PARTICLE_H_

typedef struct {
	float	x;
	float	y;
	float	z;
	} position_str;

typedef struct {
	float	x;
	float	y;
	float	z;
	} vector_str;

typedef struct {
	float m;	/* Mass  								*/
	position_str p;		/* Position 							*/
	vector_str v;		/* Velocity 							*/
	vector_str f;		/* Force 								*/
	int fixed;  /* Fixed point or free to move	*/
} particle_str;

typedef struct {
	vector_str dpdt;
	vector_str dvdt;
} particlederivatives_str;

typedef struct {
	float gravitational;
	float viscousdrag;
} particlephys_str;

typedef struct {
	int from;
	int to;
	float springconstant;
	float dampingconstant;
	float restlength;
} particlespring_str;

void CalculateForces(particle_str *,int,particlephys_str,particlespring_str *,int);
void UpdateParticles(particle_str *,int,particlephys_str,particlespring_str *,int,float);
void CalculateDerivatives(particle_str *,int,particlederivatives_str *);

#endif /* JSA_PARTICLE_H_ */
